<!--
 * @Author: Lijin
 * @Date: 2024-11-20 09:00:19
 * @LastEditors: Lijin
 * @LastEditTime: 2024-11-21 09:03:35
 * @FilePath: \electron-app\src\renderer\src\App.vue
 * @Description:
 *
 * Copyright (c) 2024 by 18323406700, All Rights Reserved.
-->
<script setup>
import Versions from './components/Versions.vue'
import { onMounted } from 'vue'

// import { ipcRenderer } from 'electron';

const ipcHandle = () => window.electron.ipcRenderer.send('ping')

const openWeb = () => {
  window.electron.ipcRenderer.send('openweb')
}

console.log(7777777)
onMounted(() => {
  console.log(window.api)
  console.log(window.electron)
  window.electron.ipcRenderer.on('do', (event, message) => {
    console.log(message) // 应该输出: Hello from main process!
  })
})
// 监听主进程发送的消息
// ipcRenderer.on('message-from-main', (event, message) => {
//     console.log(message); // 输出: Hello from main process!
// });
// console.log(window.electron)
</script>

<template>
  <img alt="logo" class="logo" src="./assets/electron.svg" />
  <div class="creator">Powered by electron-vite</div>
  <div class="text">
    Build an Electron app with
    <span class="vue">Vue</span>
  </div>
  <p class="tip">Please try pressing <code>F12</code> to open the devTool</p>
  <div class="actions">
    <!-- <div class="action">
      <a href="https://electron-vite.org/" target="_blank" rel="noreferrer">Documentation</a>
    </div> -->
    <div class="action">
      <a target="_blank" rel="noreferrer" @click="ipcHandle">Send IPC</a>
    </div>
    <div class="action">
      <a target="_blank" rel="noreferrer" @click="openWeb">获取cookie</a>
    </div>
  </div>
  <Versions />
</template>
